home *** CD-ROM | disk | FTP | other *** search
/ Champak 140 / (Vol 140) Sep 19 2011.iso / Games / theLifeArk.swf / scripts / DefineSprite_865 / frame_1 / DoAction.as
Encoding:
Text File  |  2011-09-19  |  1.4 KB  |  68 lines

  1. function onEnterFrame()
  2. {
  3.    var _loc2_ = this;
  4.    switch(_loc2_.runSta)
  5.    {
  6.       case "leaves":
  7.          _loc2_.genLeavesStep();
  8.          break;
  9.       case "rest":
  10.          _loc2_.restStep();
  11.    }
  12. }
  13. function genLeavesStep()
  14. {
  15.    var _loc2_ = this;
  16.    if(BouncerIndex < MaxBouncer)
  17.    {
  18.       BouncerIndex++;
  19.       if(BouncerIndex % 2 == 0)
  20.       {
  21.          _loc2_.attachMovie("Bouncer","Bouncer" + BouncerIndex,BouncerIndex);
  22.          _loc2_["Bouncer" + BouncerIndex].aniCtt.gotoAndStop(leafType);
  23.          _loc2_["Bouncer" + BouncerIndex]._y = -20;
  24.       }
  25.    }
  26.    if(_loc2_.timeCnt < _loc2_.leavesMax)
  27.    {
  28.       _loc2_.timeCnt = _loc2_.timeCnt + 1;
  29.    }
  30.    else
  31.    {
  32.       _loc2_.removeLeaves();
  33.       _loc2_.timeCnt = 0;
  34.       _loc2_.BouncerIndex = 0;
  35.       _loc2_.runSta = "rest";
  36.    }
  37. }
  38. function restStep()
  39. {
  40.    var _loc2_ = this;
  41.    if(_loc2_.timeCnt < _loc2_.restMax)
  42.    {
  43.       _loc2_.timeCnt = _loc2_.timeCnt + 1;
  44.    }
  45.    else
  46.    {
  47.       _loc2_.timeCnt = 0;
  48.       _loc2_.runSta = "leaves";
  49.    }
  50. }
  51. function removeLeaves()
  52. {
  53.    var _loc3_ = this;
  54.    var _loc2_ = 0;
  55.    while(_loc2_ <= _loc3_.MaxBouncer)
  56.    {
  57.       _loc3_["Bouncer" + _loc2_].removeMovieClip();
  58.       _loc2_ = _loc2_ + 1;
  59.    }
  60. }
  61. MaxBouncer = 12;
  62. BouncerIndex = 0;
  63. timeCnt = 0;
  64. runSta = "leaves";
  65. leavesMax = 180;
  66. restMax = 240;
  67. leafType = "dry";
  68.